package com.max.xihu.patterns.simple;

/**
 * @Author: Max
 * @Date: 2020-09-06 10:32
 * @Description:
 */
public class UserFactory {

    public static User create(int type) throws Exception{
        switch (type){
            case 1:
                return new AdminUser(1L,"name");
            case 2:
                return new CustomerUser();
            case 3:
                return new xiaoerUser();
            default: throw new Exception("用户类型错误");
        }
    }
}
